﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Security;
using System.Collections;

namespace Alogient.Cameleon.Membership
{
    public class CMMembershipUser : MembershipUser
    {
        public CMMembershipUser(string providername, string username, object providerUserKey, string email,
                                  string passwordQuestion, string comment, bool isApproved, bool isLockedOut,
                                  DateTime creationDate, DateTime lastLoginDate, DateTime lastActivityDate,
                                  DateTime lastPasswordChangedDate, DateTime lastLockedOutDate)
            :
                                  base(providername, username, providerUserKey, email, passwordQuestion,
                                       comment, isApproved, isLockedOut, creationDate, lastLoginDate,
                                       lastActivityDate, lastPasswordChangedDate, lastLockedOutDate)
        {
            throw new NotImplementedException("Not implemented"); // TODO
        }

        public CustomFieldValueCollection FieldValues
        {
            get;
            protected set;
        }

        public void SaveFieldValue(string name, object value)
        {
            throw new NotImplementedException("Not implemented"); // TODO
        }
    }

    public class CustomFieldValue
    {
        public string Name { get; protected set; }
        public UserFieldDataType Type { get; protected set; }
        public object Value { get; protected set; }
        public bool IsRequired { get; protected set; }

        protected CustomFieldValue()
        {
            IsRequired = false;
            Value = null;
        }

        protected CustomFieldValue(string name) : this()
        {
            throw new NotImplementedException("Not implemented"); // TODO
        }

        internal void SetValue(object value)
        {
            this.Value = value;
        }
    }

    public class CustomFieldValueCollection : List<CustomFieldValue>
    {
        public CustomFieldValue this[string name]
        {
            get
            {
                return this.FirstOrDefault(field => field.Name == name);
            }
        }
    }
}
